package com.mars.basic.allmain.vo.picture;

import com.mars.basic.allmain.po.QPicture;
import com.mars.basic.allmain.vo.PageVo;
import com.mars.common.utils.AnyWhereConditionPath;
import com.querydsl.core.types.dsl.BooleanExpression;
import lombok.Data;

@Data
public class PictureVo extends PageVo {

   String type;

   String title;

   String remark;

   String search;

   public BooleanExpression where(){
      BooleanExpression wherePredicate = AnyWhereConditionPath.anyWherePredicate();
      QPicture q = QPicture.picture;
      if (type!=null){
         wherePredicate =wherePredicate.and(q.type.eq(type));
      }
      if (search!=null){
         wherePredicate =wherePredicate.and((q.title.like("%"+search+"%")).or(q.remark.like("%"+search+"%")));
      }
      return wherePredicate;
   }
}
